﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel.Activation;
using Demo.ServiceContracts.MessageContracts;
using System.Threading;
using System.ServiceModel;

namespace Demo.ServiceImplementation
{
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]    
    public class CalculatorService  : Demo.ServiceContracts.ICalculatorService
    {
        public SumaResponse Suma(SumaRequest request)
        {
            
            SumaResponse res = new SumaResponse();
            var bc = new BusinessLogic.BCCalculator();
            res.Result = bc.Suma(request.sumandoA, request.sumandoB, request.sumandoC);                                            
      
            //try
            //{
            //}
            //catch (Exception ex)
            //{
            //    var dc = new Demo.ServiceContracts.DataContracts.DCDemoFault();
            //    dc.UIMessage = "lo sentimos intente mas tarde";
            //    dc.SupportMessage = "licencia invalida";  
            //    var fault = new FaultException<Demo.ServiceContracts.DataContracts.DCDemoFault>(dc, dc.UIMessage);
            //    throw fault;                
            //}
            
            
            return res;              
        }

        public double Multiplicacion(double a, double b)
        {
            return a * b;  
        }
        public void LogOperation(string message)
        {

            throw new System.ServiceModel.CommunicationException("tesd");
            Thread.Sleep(1000); 
    
        }
    }
}
